package com.ethink.order.facadeImpl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.order.api.TobSaleOrderFacade;
import com.ethink.order.api.info.TobSaleDetailOrderInfo;
import com.ethink.order.api.info.TobSaleOrderInfo;
import com.ethink.order.api.model.TobSaleAndSettleModel;
import com.ethink.order.api.model.TobSaleOrderGoodsModeModel;
import com.ethink.order.api.model.TobSaleOrderModel;
import com.ethink.order.api.request.*;
import com.ethink.order.api.response.TobSaleOrderAddResponse;
import com.ethink.order.api.response.TobSaleOrderDetailResponse;
import com.ethink.order.api.response.TobSaleSettlementQueryDetailResponse;
import com.ethink.order.manager.TobSaleManager;
import com.ethink.order.service.TobSaleDetailOrderService;
import com.ethink.order.service.TobSaleOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author default
 * @version 1.0.0
 * @ClassName TobSaleOrderFacadeImpl.java
 * @Description
 * @createTime 2022年11月16日 13:53:00
 */
@RestController
@Slf4j
@RequestMapping("order-service/facade/v1/tobSaleOrder")
public class TobSaleOrderFacadeImpl implements TobSaleOrderFacade {

    @Autowired
    private TobSaleOrderService tobSaleOrderService;

    @Autowired
    private TobSaleManager tobSaleManager;

    @Autowired
    private TobSaleDetailOrderService tobSaleDetailOrderService;

    @Override
    public TobSaleOrderAddResponse addTobSaleOrder(TobSaleOrderAddRequest request) {
        return tobSaleOrderService.addTobSaleOrder(request);
    }

    @Override
    public Page<TobSaleOrderModel> pageQueryTobSaleOrder(TobSaleOrderPageQueryRequest request) {
        return tobSaleOrderService.pageQueryTobSaleOrder(request);
    }

    @Override
    public TobSaleOrderDetailResponse queryDetailTobSaleOrder(Long id,Integer table) {
        return tobSaleManager.queryDetailTobSaleOrder(id,table);
    }

    @Override
    public void deleteTobSaleOrder(Long id) {
        tobSaleOrderService.deleteTobSaleOrder(id);
    }

    @Override
    public Integer updateTobSaleOrder(TobSaleOrderUpdateRequest request) {
        return tobSaleManager.updateTobSaleOrder(request);
    }

    @Override
    public TobSaleOrderInfo queryTobSaleOrderById(Long id) {
        return tobSaleOrderService.queryTobSaleOrderById(id);
    }

    @Override
    public TobSaleOrderInfo getTobSaleOrderInfoByOrderNo(String orderNo) {
        return tobSaleOrderService.getTobSaleOrderInfoByOrderNo(orderNo);
    }

    @Override
    public Page<TobSaleAndSettleModel> tobSaleAndSettlePageQuery(TobSaleAndSettlePageQueryRequest request) {
        return tobSaleOrderService.tobSaleAndSettlePageQuery(request);
    }

    @Override
    public void updateTobSaleOrderStatus(TobSaleOrderSetStatusRequest request) {
        tobSaleOrderService.updateTobSaleOrderStatus(request);
    }

    @Override
    public Boolean checkSettleImport(TobSettleImportCheckRequest checkRequest) {
        return tobSaleOrderService.checkSettleImport(checkRequest);
    }

    @Override
    public Integer TobSaleOrderPoInsert(TobSaleOrderPoInsertRequest request) {
        return tobSaleOrderService.TobSaleOrderPoInsert(request);
    }

    @Override
    public List<TobSaleDetailOrderInfo> queryDetailListByOrderNo(String orderNo) {
        return tobSaleDetailOrderService.queryDetailOrderByOrderNo(orderNo);
    }

    @Override
    public List<String> queryDetailOrderNoByOrderNo(List<String> orderNo) {
        return tobSaleOrderService.queryDetailOrderNoByOrderNo(orderNo);
    }

    @Override
    public void settleOrder(Long id) {
        tobSaleManager.settleOrder(id);
    }

    /**
     * 分页查询
     *
     * @param request
     * @return
     */
    @Override
    public Page<TobSaleOrderGoodsModeModel> pageQueryTobSaleOrderPageMode(TobSaleOrderPageGoodsModeQueryRequest request) {
        return tobSaleOrderService.pageQueryTobSaleOrderPageMode(request);
    }
}
